1. Technical Field:
The present invention relates in general to enhanced efficiency in data processing systems and in particular to enhanced efficiency in operating systems within data processing systems. Still more particularly, the present invention relates to a method of enhancing operating system efficiency in a data processing system by ensuring that data placed in temporary storage within a stack memory is aligned at a multi-byte boundary so that data may be efficiently retrieved or stored utilizing multi-byte data operations.
2. Description of the Related Art:
Modern data processing systems often utilize one or more so-called "stack" memories as temporary storage for return addresses, application parameters, local variables and other data which may be utilized during a data processing procedure. Stack memories are utilized in a Last-In, First-Out (LIFO) manner, and may be referenced either explicitly or implicitly by operating system procedures. Typically, an application within a data processing system places any required parameters within the stack memory, invoking an operating system procedure and which stores a return address therein. Next, local variables defined by specific work routines within the operating system procedure are allocated ont the stack memory. Thereafter, data required by the operating system procedure may be placed on the stack and retrieved during selected operations.
Data placed within a stack memory in a state-of-the-art data processing system is generally retrieved (fetched) utilizing multi-byte data fetch operations. Specifically, modern microprocessors often utilize four eight bit bytes of data for each fetch operations, or a so-called "double-word" fetch. Alternatively, selected microprocessors utilize two eight bit bytes of data, or a "single-word" fetch. Similarly, modern processors also store data within memory utilizing a multi-byte operation.
Thus, those skilled in the art will appreciate that a single eight bit byte of data may always be retrieved from memory with a multi-byte data fetch, ignoring the unrequired data. However, when two consecutive eight bit bytes of data are required, it is not always possible to retrieve the required two consecutive eight bit bytes of data with a single multi-byte data fetch, due to possible misalignment. As a consequence, the utilization of stack memory is preferably constrained to multi-byte boundary alignments when possible, to avoid a degradation of processor performance which results from misalignment.
In situations in which a stack memory is continually under the control of an operating system, alignment of data at multi-byte boundaries is easily accomplished utilizing existing alignment procedures. However, an operating system is preferably designed to be "called" or invoked by applications which operate within the data processing system. Once invoked, the operating system procedures will perform selected functions and thereafter return to the calling application. This dichotomy of operation results in selected aspects of the operating system environment which are not completely under the control of the operating system.
At a minimum, operating system procedures, once called, must execute instructions to obtain control over the environment. The extent to which the environment is modified will vary based upon which operating procedure has been called. For simple functions, such as returning the operating system version or release identifier, there may be no change made to the environment. For more complex functions, such as initiating another application, the operating system may choose to completely encapsulate itself while executing the request.
One aspect of the environment which is not under the control of the operating system is the status of the stack memory, which is inherited from the application which invokes the operating system procedure. There are at least two significant aspects of the stack memory status which are important to an operating system. Specifically, the amount of stack memory space which is presently available and the address alignment of the current stack pointer. The procedure within the operating system which is invoked must utilize the stack memory. At a minimum, the operating system procedure will be required to obtain the calling application's return address from the stack memory.
Typically, the operating system procedure may also make calls to its own subroutines, thereby storing more return addresses on the stack. If parameters are to be passed to the interface, then the operating system procedure code will necessarily obtain those parameters from the stack memory. Finally, the code which executes to support the interface may define local variables which are allocated onto the stack.
Unless the operating system procedure switches to a different stack memory space which is continually under the control of the operating system, the operating system procedure will execute with the inherited alignment characteristics of the stack memory provided by the calling application. Experimentation has shown that a misalignment within a stack memory wherein local variables are initially placed on the stack at other than a multi-byte boundary may result in a degradation in processor performance of twice the amount of time normally utilized for a particular transaction.
It should therefore be apparent that a need exists for a method and system whereby stack memory alignment in a data processing system may be efficiently constrained to multi-byte boundaries, such that data placed within the stack memory by the operating system procedure may be efficiently retrieved and stored utilizing multi-byte data operations.